home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 December / The Sunday Times - The Month 2003-12.iso / mac / The Month DEC 03 / engine / modules / contents.swf / scripts / frame_1 / DoAction.as
Text File  |  2003-06-20  |  2KB  |  73 lines

  1. function addLink(mc)
  2. {
  3.    Links[mc.link] = mc;
  4. }
  5. function getMCfromLink(Item)
  6. {
  7.    if(Links[Item] == null)
  8.    {
  9.       var arr = [];
  10.       while(Item != sideMenu.ItemHome)
  11.       {
  12.          arr.unshift(Item._name.split("_").pop());
  13.          Item = Item._parent._parent;
  14.       }
  15.       var str = arr.join("/");
  16.       Links[Item] = Links[str];
  17.    }
  18.    return Links[Item];
  19. }
  20. function init()
  21. {
  22.    IMAGE_PATH = Tardis.ASSETS_FOLDER + "images/" + main.ActiveSection.id + "/";
  23.    loadImage(mc_top_image,nodeData.byName("image"),IMAGE_PATH,strPathPrefix);
  24.    strActiveColor = Tardis.Colors.getString(nodeData.attributes.color);
  25.    strDefaultColor = Tardis.Colors.getString("default");
  26.    mc_links.build();
  27.    delete mc_links.build;
  28. }
  29. function doOver(Item)
  30. {
  31.    var obj = getMCfromLink(Item);
  32.    obj.gotoAndStop("over");
  33. }
  34. function doOut(Item)
  35. {
  36.    var obj = getMCfromLink(Item);
  37.    obj.gotoAndStop("off");
  38. }
  39. function linkOver(mc)
  40. {
  41.    mc.gotoAndStop("over");
  42.    Tardis.sideMenu.doOver(mc.link);
  43. }
  44. function linkOut(mc)
  45. {
  46.    mc.gotoAndStop("off");
  47.    Tardis.sideMenu.doOut(mc.link);
  48. }
  49. function linkUp(mc)
  50. {
  51.    Tardis.sideMenu.doUp(mc.link);
  52. }
  53. function loadImage(mc, node, path, pathprefix)
  54. {
  55.    var strImg = node.getText();
  56.    if(node.attributes.path != null)
  57.    {
  58.       strImg = node.attributes.path + strImg;
  59.    }
  60.    else
  61.    {
  62.       strImg = path + strImg;
  63.    }
  64.    mc.loadMovie(pathprefix + strImg);
  65. }
  66. Links = {};
  67. Tardis.sideMenu.EB.addListener(this);
  68. this.onUnload = function()
  69. {
  70.    this.onUnload = null;
  71.    Tardis.sideMenu.EB.removeListener(this);
  72. };
  73.